package routers

import (
	borrower2 "NovelBook/controller/borrower"
	"NovelBook/utils/auth"

	"github.com/gin-gonic/gin"
)

func SetBorrowerRouter(r *gin.Engine) {

	// borrower 注冊
	r.POST(baseUrl+borrowerUrl+"/register", borrower2.Register)

	// borrower 账户登录
	r.POST(baseUrl+borrowerUrl+"/login-account", borrower2.LoginByAccount)

	// borrower 邮箱登录
	r.POST(baseUrl+borrowerUrl+"/login-email", borrower2.LoginByEmail)

	// borrower 重置密码
	r.POST(baseUrl+borrowerUrl+"/reset-password", borrower2.ResetPassword)

	borrower := r.Group(baseUrl + borrowerUrl)
	borrower.Use(auth.JWTAuthSuperUser(), auth.JWTAuthBorrower())
	{
		// 修改昵称或者头像
		borrower.PUT("/user", borrower2.Modify)
		// 查看借書數量
		borrower.GET("/borrowed/num", borrower2.GetBorrowedBook)
		// 查看借书具体情况，包括借书时间，借书截止日期，是否超时等等
		borrower.GET("/borrowed/info", borrower2.GetBorrowedInfo)
		// 借書, 需要对 borrower 表、borrow_table 表进行操作

		// 通过bookUniqueID借书
		borrower.POST("/borrow", borrower2.BorrowBooks)

		// 通过bookUniqueID还书
		borrower.POST("/return", borrower2.ReturnBooks)

		// any other api you need
	}
	// any other borrower API you need
}
